package com.jinke.api.modules.ums.controller;

import com.jinke.api.common.api.CommonResult;
import com.jinke.api.modules.ums.model.ChannelCarrier;
import com.jinke.api.modules.ums.service.ChannelCarrierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "承运商与货运商关系")
@RestController
@RequestMapping("/admin/channelCarrier")
@RequiredArgsConstructor
public class ChannelCarrierController {
    private final ChannelCarrierService channelCarrierService;
    @ApiOperation("所有数据")
    @GetMapping
    public CommonResult<List<ChannelCarrier>> listAll(){
        return CommonResult.success(
                channelCarrierService.lambdaQuery()
                        .select(ChannelCarrier::getId, ChannelCarrier::getChannelCarrierName)
                        .orderByDesc(ChannelCarrier::getId).list()
        );
    }
}
